---
title: MariaDB
sidebarTitle: MariaDB
---

This is the implementation of the MariaDB data handler for MindsDB.

[MariaDB](https://mariadb.org/documentation/) is a community-developed, commercially supported fork of the MySQL relational database management system (RDBMS), intended to remain free and open-source software under the GNU General Public License. MariaDB is intended to maintain high compatibility with MySQL, library binary parity and exact matching with MySQL APIs and commands, allowing it in many cases to function as a replacement for MySQL.

## Prerequisites

Before proceeding, ensure the following prerequisites are met:

1. Install MindsDB [locally via Docker](https://docs.mindsdb.com/setup/self-hosted/docker) or use [MindsDB Cloud](https://cloud.mindsdb.com/).
2. To connect MariaDB to MindsDB, install the required dependencies following [this instruction](/setup/self-hosted/docker#install-dependencies).
3. Install or ensure access to MariaDB.

## Implementation

This handler is implemented using `mysql-connector`, a self-contained Python driver for communicating with MariaDB servers.

<Tabs>

<Tab title="Connecting using URL">

Connect MariaDB to MindsDB by providing the URL parameter. Learn more [here](https://dev.mysql.com/doc/refman/8.0/en/connecting-using-uri-or-key-value-pairs.html).

</Tab>

<Tab title="Connecting using paramaters">

Connect MariaDB to MindsDB by providing the following parameters:

* `user` is the database user.
* `password` is the database password.
* `host` is the host name, IP address, or URL.
* `port` is the port used to make TCP/IP connection. Default: 3306.
* `database` is the database name.

There are several optional parameters that can be used as well.

* `ssl` is the `ssl` parameter value that indicates whether SSL is enabled (`True`) or disabled (`False`).
* `ssl_ca` is the SSL Certificate Authority.
* `ssl_cert` stores SSL certificates.
* `ssl_key` stores SSL keys.

</Tab>

</Tabs>

## Usage

In order to make use of this handler and connect to the MariaDB database in MindsDB, the following syntax can be used:

<Tabs>

<Tab title="Connecting using URL">

```sql
CREATE DATABASE maria_datasource
WITH
  ENGINE = 'mariadb',
  PARAMETERS = {
    "url": "mysql://user@127.0.0.1:3306"
  };
```

</Tab>

<Tab title="Connecting using paramaters">

```sql
CREATE DATABASE maria_datasource
WITH
  engine = 'mariadb',
  parameters = {
    "host": "127.0.0.1",
    "port": 3306,
    "database": "mariadb",
    "user": "root",
    "password": "password"
  };
```

</Tab>

</Tabs>

You can use this established connection to query your table as follows.

```sql
SELECT *
FROM maria_datasource.example_table;
```
